package cn.cau.epidemicsurveysystem.control;


import cn.cau.epidemicsurveysystem.bean.testBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Array;


@Controller
public class BaseController {

    @RequestMapping(value= "/testJsonOne",method = RequestMethod.POST)
    @ResponseBody
    public void testJson(@RequestBody String poMessageVo) {
        System.out.println(poMessageVo);
    }

    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    public ModelAndView hello(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("flow_template_add");
        return modelAndView;
    }
    //主页跳转
    @RequestMapping(value = "/",method = RequestMethod.GET)
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("login");
        return modelAndView;
    }

    //负责静态页面的跳转
    @RequestMapping(value = "/toPage")
    public String toPage(HttpServletRequest request){
        String url=request.getParameter("url").replace(".html","");
        System.out.println("当前返回视图名称为:"+url);
        return url;
    }

}

